From c8d76b1e626946aec3ae80ec2229ae5e2766259a Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Sun, 29 Mar 2009 08:28:13 +0000 Subject: [PATCH] I'd love not to do such fixes: * Avoid calculating expensive group error pages (this strips e.g. 25% off Special:RC) --- includes/Title.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index d4bf7c2206..3ce99d80cc 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1015,7 +1015,8 @@ class Title { /** * Can $wgUser perform $action on this page? - * This skips potentially expensive cascading permission checks. + * This skips potentially expensive cascading permission checks + * as well as avoids expensive error formatting * * Suitable for use for nonessential UI controls in common cases, but * _not_ for functional access control. @@ -1200,8 +1201,14 @@ class Title { } } elseif( !$user->isAllowed( $action ) ) { $return = null; - $groups = array_map( array( 'User', 'makeGroupLinkWiki' ), - User::getGroupsWithPermission( $action ) ); + + // We avoid expensive display logic for quickUserCan's and such + $groups = false; + if (!$short) { + $groups = array_map( array( 'User', 'makeGroupLinkWiki' ), + User::getGroupsWithPermission( $action ) ); + } + if( $groups ) { $return = array( 'badaccess-groups', array( implode( ', ', $groups ), count( $groups ) ) ); -- 2.20.1